04-10 Lecture: Software Engineering, AI, and Formal Verification

Date & Time: 2026-04-10 08:26:33 Location: [Insert Location] Speaker: Kevin Sullivan

Subject

Software Engineering Artificial Intelligence Formal Verification Programming Languages LLMs Deductive Reasoning Inductive Reasoning Lean Functional Programming Theorem Proving Curry-Howard Correspondence Data Types Program Verification Type Theory Software Specification

Knowledge Point Summary

  1. The Problem with Modern AI-Generated Code: AI coding assistants (LLMs) are revolutionary for productivity but produce code with extremely low reliability (e.g., 1 error in 10 invocations), making them unsuitable for mission-critical systems like avionics, which require failure rates as low as 1 in a billion hours (10^-9). This massive reliability gap poses significant risks for large-scale, high-stakes software.

  2. Software Reliability in Critical Systems: This topic defines the stringent reliability standards required for mission-critical software, such as avionics. The core requirement is near-absolute certainty of correctness, expressed numerically as a failure rate of 10^-9 per hour, which is intended to ensure the software never fails during the entire fleet's lifespan. It highlights that testing alone is insufficient to prove the absence of bugs.

  3. Deductive vs. Inductive Reasoning in Software: This point explains the fundamental difference between traditional programming and modern AI. Traditional software operates on deductive logic (like Hoare logic), where given correct inputs and logic, the output is guaranteed to be correct. AI and LLMs operate on inductive reasoning, making predictions based on data, which is inherently probabilistic, unsound, and leads to "hallucinations" or errors.

  4. The Future of Programming: The Convergence of Inductive and Deductive Reasoning: The future isn't about one type of reasoning replacing the other, but their marriage. LLMs (inductive) can be used to generate formal proofs, which are then verified by deductive systems like the Lean proof assistant. This synergy dramatically lowers the cost and effort of creating provably correct software, making it a viable and superior alternative to traditional coding methods for building reliable systems.

  5. Curry-Howard Correspondence: This principle establishes that mathematical logic (specifically, constructive logic) and computer programming (specifically, functional programming) are isomorphic. It means that propositions can be represented as types, and proofs of those propositions can be represented as values (or objects) of those types. This allows for theorem proving to be treated as a form of programming.

  6. Function Types and Logical Implication: In programming, a function type alpha -> beta represents a function that takes a value of type alpha and returns a value of type beta. In logic, P -> Q (P implies Q) is proven by a function that takes any proof of proposition P and returns a proof of proposition Q. The arrow -> has the same meaning in both contexts: a transformation from one thing to another.

  7. Product Types and Logical Conjunction (AND): In programming, a product type alpha * beta is the type of ordered pairs where the first element is of type alpha and the second is of type beta. To construct a value of this type, you need a value of type alpha and a value of type beta. In logic, a proof of P AND Q is a pair containing a proof of P and a proof of Q.

  8. Sum Types and Logical Disjunction (OR): In programming, a sum type alpha + beta (also known as a tagged union) is a type that holds a value of either type alpha or type beta. Code that uses a sum type value must first perform a case analysis to determine which type of value is actually present. In logic, a proof of P OR Q is an object containing either a proof of P or a proof of Q. To use such a proof, one must perform a case analysis on which proof is present.

  9. Introduction to Lean for CS1: This knowledge point introduces a course designed to teach functional programming using the Lean language, structured as a CS1 course. It highlights that the course materials are available on a specific GitHub website (kevinsullivan.github.io/lean4cs1), exist in multiple versions of varying detail, and require Docker for local setup.

  10. Core Concepts of Lean Programming: This knowledge point explains the fundamental elements of programming in Lean. It covers atomic data types like natural numbers (nat), strings, and booleans, along with basic operations on them. It introduces key commands: #eval to compute the value of an expression (like a REPL) and #check to determine the type of an expression.

  11. Propositions as Types (Curry-Howard Correspondence): This explains the central idea that logical propositions are treated as types in Lean. A proof of a proposition is a value (or inhabitant) of that type. A true proposition is a type that has at least one value, while a false proposition is an empty type with no values. This allows logical reasoning to be performed through the mechanics of functional programming.

  12. Writing Predicates and Theorems in Lean: This knowledge point details how to represent logical predicates and prove theorems. Predicates are implemented as functions that return a proposition (or a boolean). Theorems are also functions that, given some inputs, return a proof for a specific proposition. Proofs can be constructed using "tactics," which are programs that automate the application of logical inference rules.

  13. Program Verification and High-Assurance Systems: This covers the application of Lean for building highly reliable software by formally verifying its correctness. The process involves creating a formal specification of a program's behavior as a type and then proving that the implementation code satisfies that specification. This method is contrasted with traditional testing, which cannot guarantee the absence of bugs, especially in critical components like compilers or hardware.

  14. The Future of Software Development: Writing Specifications: This logistical and conceptual point argues that the most critical skill for future software developers will be writing precise logical specifications, rather than just implementation code. With the rise of AI tools (LLMs) that can assist in generating code and proofs, the developer's primary role will shift to defining exactly what the software should do (the "what," not the "how").

  15. Course Logistics and Future Sessions: This covers logistical details for the class. It mentions the course schedule, including that there is one more lecture next week on vision language models, followed by student presentations. The presentation schedule is outlined as five presentations on Thursday, then six, and then five in the subsequent weeks.

Knowledge Point Explanation

1. The Problem with Modern AI-Generated Code

2. Software Reliability in Critical Systems

3. Deductive vs. Inductive Reasoning in Software

7. Product Types and Logical Conjunction (AND)

8. Sum Types and Logical Disjunction (OR)

9. Introduction to Lean for CS1

10. Core Concepts of Lean Programming

11. Propositions as Types (Curry-Howard Correspondence)

12. Writing Predicates and Theorems in Lean

13. Program Verification and High-Assurance Systems

14. The Future of Software Development: Writing Specifications

15. Course Logistics and Future Sessions

Homework

AI Suggestions